Skip to content

ci: fail when the committed openapi.json is out of date (#117) - #134

Merged
pparage merged 1 commit into
devfrom
feat/openapi-drift-guard
Aug 6, 2026
Merged

ci: fail when the committed openapi.json is out of date (#117)#134
pparage merged 1 commit into
devfrom
feat/openapi-drift-guard

Conversation

@pparage

@pparage pparage commented Aug 6, 2026

Copy link
Copy Markdown
Member

Closes #117.

Nothing regenerated or verified the spec that bootstraps the Kong gateway config, so it rotted silently — by the time #115 regenerated it, it had drifted back to the pre-v1 API: 84 paths, zero /v1. It then went stale twice more in a single day (#113's route removals, #124's new route), each caught only because I happened to be looking.

Nothing was ever going to catch it: test_api_smoke, test_routes_registered and the Dockerfile healthcheck all hit the live /docs/openapi.json, and routes_golden.json covers registered routes rather than the committed artifact.

Safe as a hard gate

Generation is deterministic and independent of the env vars it needs — byte-identical output from a different cwd with bogus paths:

d8c24de36d1231842b7d37b344d3a76d  -            (from /tmp, bogus paths)
d8c24de36d1231842b7d37b344d3a76d  -            (again)
d8c24de36d1231842b7d37b344d3a76d  openapi.json (committed)

Confirmed it actually fails on a stale spec by dropping a path and re-running the check.

Note on what this changes for everyone

Any PR that adds or modifies a route now fails CI until openapi.json is regenerated and committed. That is the point, but it is a new obligation — so the README recipe is fixed in the same commit. It previously died at import time without the env vars, which is part of why regenerating was easy to skip. It now runs verbatim, with a note that the variables only satisfy import-time reads and do not affect the output.

Nothing regenerated or verified the spec that bootstraps the Kong
gateway config, so it rotted silently — by #115 it had drifted back to
the pre-v1 API, 84 paths with zero /v1. No test reads the file: the
smoke tests and the healthcheck all hit the live /docs/openapi.json, and
routes_golden.json covers registered routes, not the artifact.

Generation is deterministic and independent of the env vars it needs
(verified: byte-identical output from a different cwd with bogus paths),
so this is safe as a hard gate. Confirmed it fails on a stale spec.

Also makes the README recipe runnable — it died at import time without
those vars, which is part of why regenerating was easy to skip.
@pparage
pparage merged commit 2b03b6a into dev Aug 6, 2026
3 checks passed
@pparage
pparage deleted the feat/openapi-drift-guard branch August 6, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant